function a(a, t, e) {
    return t in a ? Object.defineProperty(a, t, {
        value: e,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : a[t] = e, a;
}

var t, e = getApp(), o = require("../../utils/util.js");

Page({
    data: (t = {
        currMon: 0,
        curryear: "2020",
        select: 0,
        list: e.globalData.sxdata,
        infodata: null,
        modalHidden: !1,
        showModalStatus: !1,
        mengshow: !1,
        bottom: "-100%",
        sharelayer: !1,
        sharebox: !1,
        sharemodal: !1
    }, a(t, "bottom", "-100%"), a(t, "openSettingBtnHidden", !0), a(t, "hide_qcode", 1), 
    a(t, "id", 1), a(t, "name", "鼠"), a(t, "month", [ "正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "冬", "腊" ]), 
    a(t, "userInfo", ""), a(t, "hasUserInfo", !1), a(t, "canIUse", wx.canIUse("button.open-type.getUserInfo")), 
    a(t, "monthCon", !1), a(t, "foldShow", !1), a(t, "date", []), a(t, "swiperHeight", 150), 
    t),
    onLoad: function(a) {
        var t = this, n = this, s = n.options.id || n.data.id;
        if (isNaN(s)) for (var i = s.toLowerCase(), r = 0; r < n.data.list.length; r++) i == n.data.list[r].en && (s = r + 1);
        var d = decodeURIComponent(this.options.scene), h = new Date().getFullYear();
        d && ((i = e._get(d, "id")) && (s = i), n.setData({
            id: s,
            curryear: h
        })), o.getData(s, n, "sxys", function() {
            encodeURIComponent("id=" + s), n.setData({
                infodata: n.data.infodata.data
            }), console.log("数据", n.data.infodata);
        }), e.globalData.userInfo ? this.setData({
            userInfo: e.globalData.userInfo,
            hasUserInfo: !0
        }) : this.data.canIUse ? e.userInfoReadyCallback = function(a) {
            t.setData({
                userInfo: a.userInfo,
                hasUserInfo: !0
            });
        } : wx.getUserInfo({
            success: function(a) {
                e.globalData.userInfo = a.userInfo, t.setData({
                    userInfo: a.userInfo,
                    hasUserInfo: !0
                });
            }
        }), n.data.infodata && drawImg.downImg(img_user, "user_" + n.data.userInfo.nickName);
    },
    onChangeYear: function(a) {
        var t = a.currentTarget.dataset.index, e = this, o = (e.options.id || e.data.id, 
        2020);
        e.data.select > 0 && (o = e.data.infodata.year[e.data.select - 1]), e.setData({
            select: t,
            year: o,
            currMon: 0,
            foldShow: !1,
            monthCon: !1
        }), e.getData1();
    },
    getData1: function() {
        var a = this, t = {
            id: a.data.id,
            vc: "wxcode",
            token: "Mdozp+aZobSx2jK0JeglmiYkHqpuWeT3JzStGWapYqe"
        };
        a.data.select > 0 && (t.year = a.data.infodata.year[a.data.select - 1]), wx.request({
            url: "https://api.xzw.com/com/json/shengxiao_fortune.js",
            data: t,
            success: function(t) {
                var e = t.data.data.data;
                a.setData({
                    infodata: e
                }), console.log("数据", a.data.infodata);
            }
        });
    },
    viewMonth: function(a) {
        var t = a.currentTarget.dataset.index;
        this.setData({
            foldShow: !0,
            monthCon: !0,
            currMon: t
        }), this.setSwiperHeight();
    },
    hideMonth: function(a) {
        this.setData({
            currMon: 0,
            foldShow: !1,
            monthCon: !1
        });
    },
    handleChange: function(a) {
        this.setData({
            currMon: a.detail.current + 1
        }), this.setSwiperHeight();
    },
    clicksx: function(a) {
        var t = this, e = a.currentTarget.dataset.index;
        if (e === t.data.id) return o.hideModal(t), !1;
        o.getData(e, t, "sxys", function() {
            t.setData({
                infodata: t.data.infodata.data,
                select: 0,
                currMon: 0,
                foldShow: !1,
                monthCon: !1
            });
        }), o.hideModal(t, "showModalStatus", "mengshow", "bottom");
    },
    showModal: function() {
        var a = this;
        o.showModal(a, "modalHidden", "showModalStatus", "mengshow", "bottom");
    },
    hideModal: function() {
        var a = this;
        o.hideModal(a, "showModalStatus", "mengshow", "bottom");
    },
    showShareModal: function() {
        var a = this;
        a.setData({
            showTabs: !1
        }), o.showModal(a, "sharebox", "sharemodal", "sharelayer", "bot");
    },
    hideShareModal: function() {
        var a = this;
        o.hideModal(a, "sharemodal", "sharelayer", "bot");
    },
    setSwiperHeight: function() {
        var a = this, t = wx.createSelectorQuery().in(this);
        t.select(".month_swiper .cur").boundingClientRect(), t.exec(function(t) {
            var e = t[0].height;
            a.setData({
                swiperHeight: e
            });
        });
    },
    getUserInfo: function(a) {
        console.log(a), e.globalData.userInfo = a.detail.userInfo, this.setData({
            userInfo: a.detail.userInfo,
            hasUserInfo: !0
        }), drawImg.downImg(a.detail.userInfo.avatarUrl, "user_" + a.detail.userInfo.nickName), 
        drawImg.setData({
            userInfo: a.detail.userInfo
        });
    },
    share: function() {
        var a = this;
        o.hideModal(a, "sharemodal", "sharelayer", "bot"), drawImg.setData({
            xzimg: wx.getStorageSync("xzimg_" + a.data.id),
            img_user: wx.getStorageSync("user_" + a.data.userInfo.nickName),
            qcode: wx.getStorageSync("qcode_" + a.data.id),
            userInfo: a.data.userInfo,
            desc: a.data.infodata[a.data.currentTab],
            currentTab: a.data.currentTab,
            xzname: a.data.name,
            date: a.data.date
        }), a.setData({
            hide_qcode: 0
        }), drawImg.draw(a);
    },
    closeQcode: function() {
        this.setData({
            hide_qcode: 1
        });
    },
    handleSetting: function(a) {
        var t = this;
        a.detail.authSetting["scope.writePhotosAlbum"] && (t.setData({
            openSettingBtnHidden: !0
        }), drawImg.save_file(t));
    },
    inbtn: function(a) {
        console.log("in");
    },
    onShareAppMessage: function(a) {
        return {
            title: '属'+this.data.name+'的人'+this.data.curryear+'年'+this.data.month[this.data.currMon]+'月生肖运势-周公解梦', 
            path: "/pages/fortune_sx/fortune_info?id=" + this.data.id, 
            success: function(a) {},
            fail: function(a) {}
        };
    },
    onShareTimeline(){
        return {
            title: '属'+this.data.name+'的人'+this.data.curryear+'年'+this.data.month[this.data.currMon]+'月生肖运势-周公解梦', 
            path: "/pages/fortune_sx/fortune_info?id=" + this.data.id, 
            success: function(a) {},
            fail: function(a) {}
        };
    },
    showTabs: function() {
        var a = !this.data.showTabs;
        this.setData({
            showTabs: a
        });
    },
    hideTabs: function() {
        this.setData({
            showTabs: !1
        });
    }
});